#include "CovarMatrix.h"


CovarMatrix::CovarMatrix()
{
	IplImage* in;
	IplImage* img_gray = cvCreateImage(cvGetSize(in), IPL_DEPTH_8U,1);
	cvCvtColor(in, img_gray, CV_BGR2GRAY);
	cvEqualizeHist(img_gray,img_gray);

	IplImage *xsobel_temp = cvCreateImage(cvGetSize(in), IPL_DEPTH_16S,1);
	IplImage *ysobel_temp = cvCreateImage(cvGetSize(in), IPL_DEPTH_16S,1);

	IplImage *xsobel = cvCreateImage(cvGetSize(in), IPL_DEPTH_8U,1);
	IplImage *ysobel = cvCreateImage(cvGetSize(in), IPL_DEPTH_8U,1);
	cvSobel(img_gray,xsobel_temp,1,0);
	cvSobel(img_gray,ysobel_temp,0,1);

	cvConvertScale(xsobel_temp,xsobel, 1, 0);
	cvConvertScale(ysobel_temp,ysobel, 1, 0);

	cvReleaseImage(&img_gray);
}

CovarMatrix::~CovarMatrix() {}